]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dbus: Avoid losing org.freedesktop.Notifications on replacement
authorColin Walters <walters@verbum.org>
Wed, 30 Mar 2011 18:34:42 +0000 (14:34 -0400)
committerColin Walters <walters@verbum.org>
Wed, 13 Apr 2011 13:41:33 +0000 (09:41 -0400)
We weren't specifying _ALLOW_REPLACEMENT for anything except
org.gnome.Shell, which created a race - if the exiting process
didn't exit fast enough, the replacing process would fail
to get the name.

https://bugzilla.gnome.org/show_bug.cgi?id=646257

src/main.c

index 589b27f1a36ad44a49e3f7376096931eb92354cd..5472953b91b04bece413205847aea5a1d0c6df71 100644 (file)
@@ -73,13 +73,10 @@ shell_dbus_init (gboolean replace)
       exit (1);
     }
 
-  /* Also grab org.gnome.Panel to replace any existing panel process,
-   * unless a special environment variable is passed.  The environment
-   * variable is used by the gnome-shell (no --replace) launcher in
-   * Xephyr */
+  /* Also grab org.gnome.Panel to replace any existing panel process */
   if (!dbus_g_proxy_call (bus, "RequestName", &error, G_TYPE_STRING,
                           "org.gnome.Panel", G_TYPE_UINT,
-                          DBUS_NAME_FLAG_REPLACE_EXISTING | DBUS_NAME_FLAG_DO_NOT_QUEUE,
+                          DBUS_NAME_FLAG_REPLACE_EXISTING | request_name_flags,
                           G_TYPE_INVALID, G_TYPE_UINT,
                           &request_name_result, G_TYPE_INVALID))
     {
@@ -91,7 +88,7 @@ shell_dbus_init (gboolean replace)
    */
   if (!dbus_g_proxy_call (bus, "RequestName", &error,
                           G_TYPE_STRING, MAGNIFIER_DBUS_SERVICE,
-                          G_TYPE_UINT, 0,
+                          G_TYPE_UINT, DBUS_NAME_FLAG_REPLACE_EXISTING | request_name_flags,
                           G_TYPE_INVALID,
                           G_TYPE_UINT, &request_name_result,
                           G_TYPE_INVALID))
@@ -101,11 +98,13 @@ shell_dbus_init (gboolean replace)
        * but keep going. */
     }
 
-  /* ...and the org.freedesktop.Notifications service.
+  /* ...and the org.freedesktop.Notifications service; we always
+   * specify REPLACE_EXISTING to ensure we kill off
+   * notification-daemon if it was running.
    */
   if (!dbus_g_proxy_call (bus, "RequestName", &error,
                           G_TYPE_STRING, "org.freedesktop.Notifications",
-                          G_TYPE_UINT, DBUS_NAME_FLAG_REPLACE_EXISTING | DBUS_NAME_FLAG_DO_NOT_QUEUE,
+                          G_TYPE_UINT, DBUS_NAME_FLAG_REPLACE_EXISTING | request_name_flags,
                           G_TYPE_INVALID,
                           G_TYPE_UINT, &request_name_result,
                           G_TYPE_INVALID))